﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Data.Linq.Mapping;
using System.Data.Linq;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using NDepot.Models.UI;
using NDepot.Models.Base;

namespace NDepot.Models
{
    [Table]
    public class LineItem : PersistentObject
    {
        [HiddenInput(DisplayValue = false)]
        [Column(IsPrimaryKey = true)]
        public Guid Id { get; set; }

        [RequiredAttribute]
        [Column]
        public Guid ProductId { get; set; }
        private EntityRef<Product> _Product;
        [System.Data.Linq.Mapping.Association(Storage = "_Product", ThisKey = "ProductId")]
        public Product Product
        {
            get { return this._Product.Entity; }
            set { this._Product.Entity = value; }
        }

        [RequiredAttribute]
        [Column]
        public Guid OrderId { get; set; }
        private EntityRef<Order> _Order;
        [System.Data.Linq.Mapping.Association(Storage = "_Order", ThisKey = "OrderId")]
        public Order Order
        {
            get { return this._Order.Entity; }
            set { this._Order.Entity = value; }
        }

        [RequiredAttribute]
        [Column]
        public int Quantity { get; set; }

        [RequiredAttribute]
        [Column]
        public decimal TotalPrice { get; set; }
    }
}